<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="vue.js"></script>
</head>

<body>
  <div id="app">
    <button @click="change">改变值</button>
    <ul>
      <li v-for="(item,index) in arr">
        {{item}}
      </li>
    </ul>
  </div>
  <script>
    new Vue({
      el: "#app",
      data: {
        arr: [1, 2, 3, 4]
      },
      methods: {
        change() {
          // this.arr[0] = 100;
          // console.log(this.arr);
          // this.arr.length = 2;
          // console.log(this.arr);
         /*  this.$set(this.arr,0,100); */
         //Vue.set(this.arr,0,200);
         this.arr.splice(2,2);
        }
      }
    })
  </script>
</body>

</html>